<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>【BBS红色论坛】</title>
    <link rel="stylesheet" href="/css/main/main.css" th:href="@{/css/main/main.css}">
    <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>

</head>
<body>
   <div class="bigheader">
       <div class="header">
           <div class="miniheader">
               <!-- 顶部左边 -->
                <div class="timeAndwordsbox" >
                    <div class="timeAndwordsbox-div" >
                        <a href="javascript:void(0)" id="timeShow"></a>
                    </div>
                    <div class="timeAndwordsbox-div" id="apple">
                        <ul class="timeAndwordsbox-ul">
                            <li><a href="javascript:void(0)" target="_blank">新时代属于每一个人</a></li>
                            <li><a href="javascript:void(0)" target="_blank">山再高，往上攀，总能登顶</a></li>
                            <li><a href="javascript:void(0)" target="_blank">路再长，走下去，定能到达</a></li>
                            <li><a href="javascript:void(0)" target="_blank">加满油，把稳舵，鼓足劲</a></li>
                            <li><a href="javascript:void(0)" target="_blank">一定能够创造出一个又一个人间奇迹</a></li>
                            <li><a href="javascript:void(0)" target="_blank">人民有信心，国家才有未来和力量</a></li>
                        </ul>
                    </div>
                </div>
                <!-- 顶部中间 -->
                <div class="searchbox">
                    <div class="search">
                        <form action="/search_lnc" id="searchform" method="post">
                            <input type="text" class="srch" name="srch">
                            <div class="search-btn">
                                <button type="submit" class="search-btn-submit">
                                    搜索
                                </button>
                            </div>
                    </form>
                    </div>
                </div>
                <!-- 顶部右边 -->
                <div class="userbox">
                    <div class="user-center">
                        <div class="item">
                            <a href="userLogin" title="登录"  th:if="${username} eq 'login'">
                                <!--点击这里会跳转到登录---->
                                <span class="userspan">
                                    <img src="../images/personmes/touxiang.png" alt="" style="width:36px;height:36px;border-radius:36px">
                                </span>
                                <span th:text="登录" class="userspan">
                                </span>
                            </a>
                            <a href="../viewPost?page=/html/personimfhtml/mainperonif" title="访问个人中心"  th:if="${username} ne 'login'">
                                <!--点击这里会跳转到个人中心---->
                                <span class="userspan">
                                    <img th:src="@{'../'+${hphoto}}" alt="" style="width:36px;height:36px;border-radius:36px">
                                </span >
                                <span th:text="${username}" class="userspan"></span>
                            </a>
                        </div>
                        <div class="item">
                            <!-- 我的点击后会浮动出帖子，收藏 -->
                            <span><a href="javascript:void(0)">我的</a></span>
                            <div class="item-content" th:if="${username} ne 'login'">
                                <a th:href="@{/mypost/search}"><li>帖子</li></a>
                                <a href="../viewPost?page=/html/collectposthtml/miancollectif"><li>收藏</li></a>
                                <a href="../viewPost?page=/html/personimfhtml/cmappliedif"><li>消息<span th:if="${info} " th:text="${info}"  id="info"></span></li></a>
                            </div>
                        </div>
                        <div class="item">
                            <!-- 点击发帖跳转到发帖界面 -->
                            <a href="../viewPost?page=/html/editor/writePost_f">发帖</a>
                        </div>
                        <div class="item" >
                            <a href="javascript:void(0)" id="zzgl">组织管理</a>
                        </div>
                        <div class="item">
                            <a href="/switch">账号切换</a>
                        </div>
                        <div class="item">
                            <a href="javacsript:void(0)" id="hzgl">徽章管理</a>
                        </div>
                    </div>
                    <div id="logout">
                        <span><a href="/logout">退出</a></span>
                    </div>
               </div>
           </div>
       </div>
       <div class="banner" style="background-image: url(../images/main/topbanner.jpg);"></div>
       <div class="wrap">
           <div class="primary-menu">
               <ul class="con">
                   <li>
                       <a href="/main">
                           <div class="round">
                               <img src="../images/main/home.jpg" alt="">
                           </div>
                           <span>首页</span>
                       </a>
                   </li>
                   <span class="jiange"></span>
                   <li>
                        <a href="/viewzuzhi">
                            <div class="round">
                                <img src="../images/main/zuzhi.jpg" alt="">
                            </div>
                            <span>组织</span>
                        </a>
                    </li>
                   <span class="jiange"></span>
                    <li>
                        <a href="/shop/shopping">
                            <div class="round">
                                <img src="../images/main/红色商城.jpg" alt="">
                            </div>
                            <span>红色商城</span>
                        </a>
                    </li>
                   <span class="jiange"></span>
                    <li>
                        <a href="/viewluntan">
                            <div class="round">
                                <img src="../images/main/论坛.jpg" alt="">
                            </div>
                            <span>论坛</span>
                        </a>
                    </li>
               </ul>
           </div>
       </div>
   </div>
    <div class="maincontentbox" id="maincontentbox">
        <div th:if="${!#strings.contains(page,'html/')}">
            <div th:replace="${page}::part" ></div>
        </div>
        <div th:if="${#strings.contains(page,'html/')}">
<!--            <th:block th:if="${!#strings.contains(page,'?')}">-->
                <div th:replace="${page}" ></div>
<!--            </th:block>-->
<!--            <th:block th:if="${#strings.contains(page,'?')}">-->
<!--&lt;!&ndash;                <iframe th:src="${page}"  id="iframe"  scrolling="no" frameborder="0" width="100%" height="auto"></iframe>&ndash;&gt;-->
<!--                <iframe id="iframe" src="/html/editor/viewPost.do?pid=2" frameborder="0" width=1280 height=700 name="main" scrolling="no" onload="this.height=100"></iframe>-->
<!--                <script type="text/javascript">-->
<!--                    function reinitIframe(){-->
<!--                        var iframe = document.getElementById("iframe");-->
<!--                        try{-->
<!--                            var bHeight = iframe.contentWindow.document.body.scrollHeight;-->
<!--                            var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;-->
<!--                            var height = Math.max(bHeight, dHeight);iframe.height = height;-->
<!--                            console.log(height);-->
<!--                        }catch (ex){}-->
<!--                    }window.setInterval("reinitIframe()", 200);-->
<!--                </script>-->
<!--            </th:block>-->
<!--            <th:block th:if="${pid} != null">-->
<!--                <div th:replace="${page}" ></div>-->
<!--            </th:block>-->
<!--            <div th:replace="${page}" ></div>-->
        </div>
<!--        <div th:if="${uid} != null ">-->
<!--            <iframe th:src="${page} +'?pid='+ ${uid}"  id="iframe"  scrolling="no" frameborder="0" width="100%" height="auto"></iframe>-->
<!--        </div>-->

    </div>
   <div class="footer">
       <div class="footer-con" >
           <p>桂电蓝桥第三组</p>
       </div>
   </div>
</body>
<script language="javascript" th:inline="javascript">
    $("#zzgl").click(function () {
        var user = [[${session.user}]];
        if (user==null){
            alert("请先登录！");
        }else{
            var userrole =  user.role;
            if (userrole=='组织管理员'){
                $("#zzgl").attr('href', '/om/viewOUser');
            }else {
                alert("抱歉，您没有权限！");
                $("#zzgl").attr('href', 'javacsript:void(0)');
            }
        }
    });
    $("#hzgl").click(function () {
        var user = [[${session.user}]];
        if (user==null){
            alert("请先登录！");
        }else{
            var userrole =  user.role;
            if (userrole=='组织管理员'){
                $("#hzgl").attr('href', '/badgeSet.do');
            }else {
                alert("抱歉，您没有权限！");
                $("#hzgl").attr('href', 'javacsript:void(0)');
            }
        }
    });
    var t = null;
    t = setTimeout(time,0);//开始执行
    function time(){
        clearTimeout(t);//清除定时器
        dt = new Date();
        var y=dt.getYear()+1900;
        var mm=dt.getMonth()+1;
        var d=dt.getDate();
        var weekday=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"];
        var day=dt.getDay();
        var h=dt.getHours();
        var m=dt.getMinutes();
        var s=dt.getSeconds();
        document.getElementById("timeShow").innerHTML =  "今天是"+y+"年"+mm+"月"+d+"日"+weekday[day];
        t = setTimeout(time,1000); //设定定时器，循环执行           
    }

    //	    金句滚动
    function timer(opj) {
            $(opj).find('ul').animate({
                marginTop: "-36px"
            }, 500, function() {
                $(this).css({
                    marginTop: "0px"
                }).find("li:first").appendTo(this);
            })
        }
        $(function() {
            var time = setInterval('timer("#apple")', 7000); //新闻列表滚动
            var mit = setInterval('timer(".maquee")', 7000); //中奖名单-停顿滚动
            $('#apple ul:last-child').find('li').mousemove(function() {
                clearInterval(time);
            }).mouseout(function() {
                time = setInterval('timer("#apple")', 7000);
            });
        });
</script>
</html>